#!/bin/bash

set -e

echo "=== Begin ==="

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

cd "$SCRIPT_DIR/../../yecc"
echo "[INFO] Using yecc/build/code.bin "

if [ ! -f build/code.bin ]; then
    echo "there is no code.bin"
    exit
fi

cd "$SCRIPT_DIR"

mkdir -p build
cp ../../yecc/build/code.bin ./build/Image

cd build
xxd -i Image > Image.h
echo "[INFO] xxd -i Image > Image.h"

echo "===  End  ==="